from django.db import models

from fgww.utils.models import BaseModel


# Create your models here.


class NavModel(BaseModel):
    POSITION_CHOICES = {
        (0, '顶部导航'),
        (1, '底部导航'),
    }
    title = models.CharField(max_length=20,verbose_name='标题')
    link = models.CharField(max_length=255, verbose_name='导航连接')
    is_http = models.BooleanField(default=False, verbose_name='是否是外部连接')

    position = models.IntegerField(choices=POSITION_CHOICES, default=0)

    class Meta:
        db_table = 'fg_nav'

        verbose_name_plural = '导航菜单'


# 轮播图模型类
class BannerModel(BaseModel):
    image = models.ImageField(upload_to='banner/%Y/', verbose_name='图片地址')
    link = models.CharField(max_length=255, verbose_name='轮播点击连接')
    note = models.CharField(max_length=200, null=True, verbose_name='备注信息')
    is_http = models.BooleanField(default=False, verbose_name='是否是外部连接',
                                  help_text="站点外部连接：http://www.baidu.com <br> 站点内连接：/home/banner")

    class Meta:
        db_table = "fg_banner"
        verbose_name_plural = "轮播广告图"


